#include<stdlib.h>
#include<time.h>
#include"ProcessBar.h"
#define TOTAL 1024.0

void Download(){

  srand((unsigned int)time(NULL));
  int speed = rand()%10;//0 ~ 9

  int cur_load = 0;
  while(cur_load <= TOTAL){
    //打印进度条
    Process(cur_load, TOTAL);
    usleep(20000);
    //sleep(1);
    // 
    if(cur_load == TOTAL){
      printf("\n");
      return;
    }
    //重新计算下载量
    cur_load += speed;
    if(cur_load > TOTAL) cur_load = TOTAL;
    speed = rand()%10;
  }
}



int main(){
  Download();
  return 0;
}
